package com.ntes.consumer2.controller;

import com.ntes.consumer2.service.IDemoService;
import com.ntes.consumer2.service.Service0Client;
import com.ntes.model.User;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by bjliuyue1 on 2017/5/21.
 */
@RestController
public class DemoController {

    @Autowired
    private IDemoService demoService;
    @Autowired
    private Service0Client service0Client;

    @RequestMapping("/user")
    public User user(HttpServletRequest request) {
        return demoService.getUser(request.getParameter("name"));
    }

    @RequestMapping("string")
    public String string(HttpServletRequest request) {
        return demoService.getString(request.getParameter("name")) + " consumer2";
    }

    @RequestMapping("string1")
    public String str(HttpServletRequest request) {
        return service0Client.test("12") + " consumer2";
    }
}
